{% include 'admin/header.html' %}

<body>
  <!-- 页面loading -->
  <div id="lyear-preloader" class="loading">
    <div class="ctn-preloader">
      <div class="round_spinner">
        <div class="spinner"></div>
        <img alt="Loading" src="/static/v5/images/loading-logo.png">
      </div>
    </div>
  </div>
  <!-- 页面loading end -->

  <div class="lyear-layout-web">
    <div class="lyear-layout-container">
      {% include 'admin/nav.html' %}

      <main class="lyear-layout-content">
        <div class="container-fluid">
          <!-- 楼栋管理模块 -->
          <div class="row">
            <div class="col-lg-12">
              <div class="card shadow-sm">
                <!-- 提示信息 -->
                <div class="alert alert-info" role="alert">
                  楼栋信息列表，您可以编辑或删除楼栋信息。
                </div>

                <!-- 卡片标题部分 -->
                <header class="card-header d-flex justify-content-between align-items-center bg-primary text-white">
                  <h4 class="card-title mb-0">楼栋列表</h4>
                  <div>
                    <a href="{{ url_for('main.add_dorm_type') }}" class="btn btn-light btn-sm">添加楼栋</a>
                  </div>
                </header>

                <!-- 卡片内容部分 -->
                <div class="card-body">
                  <div class="table-responsive">
                    <table class="table table-striped table-bordered table-hover">
                      <thead class="thead-dark">
                        <tr>
                          <th>ID</th>
                          <th>楼栋名称</th>
                          <th>操作</th>
                        </tr>
                      </thead>
                      <tbody>
                        {% for dorm_type in dorm_types %}
                          <tr>
                            <td>{{ dorm_type.id }}</td>
                            <td>{{ dorm_type.name }}</td>
                            <td class="text-center">
                              <a href="{{ url_for('main.edit_dorm_type', id=dorm_type.id) }}" class="btn btn-warning btn-sm" aria-label="编辑楼栋">编辑</a>
                              <a href="{{ url_for('main.delete_dorm_type', id=dorm_type.id) }}" class="btn btn-danger btn-sm" aria-label="删除楼栋" onclick="return confirm('确定要删除吗？')">删除</a>

                            </td>
                          </tr>
                        {% endfor %}
                      </tbody>
                    </table>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </main>
    </div>
  </div>

{% include 'admin/footer.html' %}
</body>
